<?php
class ConfigurationHandler
{
    var $configuration;
    var $next; //ConfigurationHandler
    
    function setConfiguration(){} //abstract 
    
    function setUpdateTime($newUpdateTime)
    {
        $this->configuration['UpdateTime'] = $newUpdateTime;
    }    
    function getUpdateTime()
    {
        return $this->configuration['UpdateTime']; 
    } 
    
    function getHandlerConfiguration()
    {
        return $this->configuration;
    }

    function getConfiguration()
    {
        if (!$this->isUpdated())
        {
            $this->setConfiguration();
        }  
        
        return  $this->getHandlerConfiguration();
    }    
    
    function setNext($newNext)
    {
        $this->next = $newNext;    
    }
    function getNext()
    {
        return $this->next;
    }
    
    function getConfigurationXMLFile()
    {
        return Barakus::getPath("Application") . "/configuration.xml";
    }
    
    function isUpdated()
    {
        return 
        (
            !empty($this->getUpdateTime()) && 
            (filemtime($this->getConfigurationXMLFile()) == $this->getUpdateTime())
        );    
    }
    
}
?>
